<?
    include './common.php';
    $sql = "SELECT n.id AS `newId`, header,contents,typename,countryname,imgSrc,ptime FROM `news` AS n JOIN type AS t ON n.typeid = t.id JOIN country AS c ON n.countryid = c.id WHERE n.id = {$_GET['id']}";
    // echo $sql;
    $res = mysqli_query($link,$sql);
    // var_dump($res);
    $one = mysqli_fetch_assoc($res);
    // $now = new DateTime($one['ptime']);
    // var_dump($now) ;
   
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
        .text{
            width: 640px;
            margin: 0 auto;
        }
        .article-info{
            color:#999;
            font-size: 14px;
        }
        p{
            font-size: 16px;
            line-height: 30px;
        }
    </style>
    <script src="./ajax.js"></script>
</head>
<body>
    <div class="text">
        <h1 class="title"><?echo$one['header']?></h1>
        <div class="article-info"> <?echo$one['typename']?> 时间：<? echo date('Y-m-d H:i',$one['ptime']);?></div>
        <p class="content">
        <img style="width:700px;height:auto;margin:10px auto;" src="./uploads/<?echo$one['imgSrc']?>" alt="">
            <?echo $one['contents']?>
        </p>
    </div>
</body>
</html>